
    $(document).ready(function () {
        $("p:first").click(function () {
            $(this).hide();
        });

        $("#btn1").click(function () {
            alert("Text: " + $("#testbtn1").text());
        });

        $("#btn2").click(function () {
            alert("HTML:" + $("#testbtn2").html());
        });

        $("#btn3").click(function () {
            $("p").addClass("blue");
        });

        $("#btn4").click(function () {
            $("p").removeClass("blue");
        });

        $("a").click(function (event) {
            alert("Thank you for your visiting!");
            event.preventDefault();
        });

        $("#checkbox1").click(function () {

            $("#checkbox1").attr("checked", true);

        });


        $("#orderedlist").addClass("backgroundRed");

        $("#orderedlist2").addClass("backgroundBlue");

        $("#orderedlist > li").addClass("blue");

        $("#orderedlist2 > li").addClass("red");

        $("#orderedlist li:last").hover(function () {
            $(this).addClass("green");
        }, function () {
            $(this).removeClass("green");
        });

        $("#orderedlist li").each(function (i) {
            $(this).append("BAM!" + i);
        });

        $("#orderedlist2").find("li").each(function (i) {
            $(this).append("BAM!" + i);
        });




        $("#reset").click(function () {
            $("form").each(function () {
                this.reset();
            });
        });

        $("li").not(":has(ul)").css("border", "1px solid black");


        $('#faq').find('dd').hide().end().find('dt').click(function () {
            var answer = $(this).next();
            if (answer.is(':visible')) {
                answer.slideUp();
            } else {
                answer.slideDown();
            }
        });



        var ratingMarkup = ["Please rate: "];
        for (var i = 1; i <= 5; i++) {
            ratingMarkup[ratingMarkup.length] = "<a href='#'>" + i + "</a> ";
        }
        // add markup to container and applier click handlers to anchors
        $("#rating").append(ratingMarkup.join('')).find("a").click(function (e) {
            //e.preventDefault();
            // send requests
            $.post("rate.php", { rating: $(this).html() }, function (xml) {
                // format result
                var result = [
                    "Thanks for rating, current average: ",
                    $("average", xml).text(),
                    ", number of votes: ",
                    $("count", xml).text()
                ];
                // output result
                $("#rating").html(result.join(''));
            });
        });


        $("a").toggle(function () {
            $(".stuff").animate({
                height: 'hide',
                opacity: 'hide'
            }, 'slow');
        }, function () {
            $(".stuff").animate({
                height: 'show',
                opacity: 'show'
            }, 'slow');
        });


        $("#mytablesorter").tablesorter({
                // pass the headers argument and assing a object 
                headers: {
                    // assign the secound column (we start counting zero) 
                    1: {
                        // disable it by setting the property sorter to false 
                        sorter: false
                    },
                    // assign the third column (we start counting zero) 
                    2: {
                        // disable it by setting the property sorter to false 
                        sorter: false
                    }
                }
            });

    });
